/*
 * Copyright 2010 J Patrick Davenport
 * 
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 * 
 * http://www.apache.org/licenses/LICENSE-2.0
 * 
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */
package v4view.web;

/**
 * Creates a tag pair with just content.
 * @author J Patrick Davenport
 *
 */
class Dynamic extends ChildbearingPageElement {

	public Dynamic(final String _tag, final String _bodyContent) {
		this.setTag(_tag);
		final Content element = new Content(_bodyContent);
		element.setElementId("myConent");
		super.addPageElement(element);
	}

	public String getBodyContent() {
		return ((Content) this.findElement("myConent")).getContent();
	}

	public void setBodyContent(final String _bodyContent) {
		((Content) this.findElement("myConent")).setContent(_bodyContent);
	}

	/**
	 * @throws UnsupportedOperationException Does not allow direct manipulation of its children
	 */
	@Override
	public ChildbearingPageElement addPageElement(final PageElement _element) throws UnsupportedOperationException {
		throw new UnsupportedOperationException("Children elements are not supported");
	}

	/**
	 * @throws UnsupportedOperationException Does not allow direct manipulation of its children
	 */
	@Override
	public void removePageElement(final String _controlId) {
		throw new UnsupportedOperationException("Children elements are not supported");
	}
}
